function countDownBySecond(restSeconds, timeInterval, func, endCallback) {
    let timer = null;
    let total = restSeconds;
    timeInterval = timeInterval ? timeInterval : 1000;
    timer = setInterval(function () {
        --total;
        if (total <= 0) {
            clearInterval(timer);
            endCallback && endCallback();
        }
        func && func(total);
    }, timeInterval);
}
var hi = function () {
    console.log("倒计时一秒啦");
}
var bye = function () {
    console.log("秒杀活动结束啦");
}
countDownBySecond(10, 1000, hi, bye);
